﻿
@{
    UserInfoModel loginser = ViewBag.UserInfo as UserInfoModel;
    ViewBag.Title = "MyInfo";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<style>
    .center {
        text-align: center;
    }
</style>

<h2>我的信息</h2>

<div class="row">
    <div class="col-lg-12 ">
        <div class="panel panel-primary">
            <div class="panel-heading">C#获取我的信息</div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-12 ">ID: @loginser.Id</div>
                </div>
                <div class="row">
                    <div class="col-lg-12 ">用户名: @loginser.UserName</div>
                </div>

                <div class="row">
                    <div class="col-lg-12 ">手机号: @loginser.UserPhone</div>
                </div>
                <div class="row">
                    <div class="col-lg-12 ">最后登录时间: @loginser.LastDate</div>
                </div>
                <div class="row">
                    <div class="col-lg-12 ">登录次数: @loginser.LoginAt</div>
                </div>
            </div>
        </div>
    </div>

</div>



<div class="row">
    <div class="col-lg-12 ">
        <div class="panel panel-info">
            <div class="panel-heading">ajax获取我的信息</div>
            <div class="panel-body">
                <div class="row">
                    <input type="hidden" id="userid" />
                    <div class="col-lg-12 ">
                        用户名:
                        <input type="text" id="uUserName" class="form-control" placeholder="请输入用户名">
                    </div>
                </div>

                <div class="row">
                    <div class="col-lg-12 ">
                        手机号:
                        <input type="text" id="uUserPhone" class="form-control" placeholder="请输入手机号">
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12 ">最后登录时间:<span id="lasteDate"></span></div>
                </div>
                <div class="row">
                    <div class="col-lg-12 ">登录次数: <span id="loginAmount"></span></div>
                </div>
            </div>
        </div>
    </div>
</div>


@section scripts{
    <script type="text/javascript">
        $(() => {
            request({
                url: '/Home/GetUserInfo',
                success: function (data) {
                    if (data.code == 200) {
                        $("#uUserName").val(data.data.UserName);
                        $("#uUserPhone").val(data.data.UserPhone);
                        $("#lasteDate").text(data.data.LastDate);
                        $("#loginAmount").text(data.data.LoginAt);
                    }
                }
            });
        })
    </script>
}


